<?php

/**
 * Description of UserInfo
 *
 * @author    Mon Zafra <monzee at gmail>
 * @copyright (c)2009 Mon Zafra
 * @license   http://monzee.wordpress.com/license New BSD
 * @version   $Id: UserInfo.php 38 2009-02-18 17:12:39Z monzee $
 */
class Admin_Form_UserInfo extends Zend_Form
{
    public function init()
    {
        $axsMgr = Zend_Controller_Action_HelperBroker::getStaticHelper('AccessManager');
        $res = $axsMgr->getAclModel()->getAllRoles();
        $roles = array();
        foreach ($res as $role) {
            $roleId = $role['id'];
            $roleDesc = $role['description'];
            $roles[$roleId] = $roleDesc;
        }

        $this->setMethod('post')
            ->setDisableLoadDefaultDecorators(true)

            ->addElement('text', 'username', array(
                'label' => 'Username', 'class' => 'thick',))

            ->addElement('text', 'email', array(
                'label' => 'Email address', 'class' => 'text'))

            ->addElement('password', 'password', array(
                'label' => 'Password', 'class' => 'text'))
        
            ->addElement('password', 'passwordConfirm', array(
                'label' => 'Confirm password', 'class' => 'text'))

            ->addElement('checkbox', 'passwordReset', array(
                'label' => 'Reset password',))

            ->addElement('multiCheckbox', 'roles', array(
                'label' => 'Assign roles to this user',
                'multiOptions' => $roles,))

            ->addElement('submit', 'submit', array(
                'label' => 'Commit changes', 'ignore' => true,))

            ->addElement('submit', 'disable', array(
                'label' => 'Disable account', 'ignore' => true,))
        ;
    }

}
